<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      .red {
          color: red;
          transition: all 1s;
      }

      .gold {
          color: gold;
          transition: all 1s;
      }

      .blue {
          color: blue;
          transition: all 1s;
      }
  </style>
</head>
<body>
  <div id="app">
      <h1 v-if='flag' @click='changeFlag' >v-if</h1>
      <h1 v-else  @click='changeFlag' >v-else</h1>
      <hr>
      <h2 v-if="num >10 && num <= 40" class="red">red</h2>
      <h2 v-else-if="num >40 && num <= 60" class="gold">gold</h2>
      <h2 v-else class="blue">blue</h2>
      <button @click='addNum'>changNum</button>
  </div>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el:'#app',
      data:{
          flag: true,
          num: 20
      },
      methods:{
          changeFlag() {
              this.flag = !this.flag
          },
          addNum() {
             this.num<80 ? this.num += 20 : this.num = 30
          }
      }
     });
  </script>
</body>
</html>
